import { BaseWindow } from "../../../component/window/BaseWindow";
import { ILayer } from "../../../mvc/interfaces/ILayer";
import { Language } from "../../../../extend/language/Language";
import { ChristmasActivitiesConfig } from "../../resource/ChristmasActivitiesConfig";
import { DataEvent } from "../../events/DataEvent";
import { ChristmasActivitiesInfo } from "../../model/ChristmasActivitiesInfo";
import { ChristmasList } from "../activity/christmas/ChristmasList";
import { EventName } from "../../mvc/EventName";
import { ChristmasDesPanel } from "../activity/christmas/ChristmasDesPanel";
import { ChristmasRewardPanel } from "../activity/christmas/ChristmasRewardPanel";
//class RecallOldPlayerActivitiesPanel
    
    export  class RecallOldPlayerActivitiesPanel extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            setSize(635, 455);
            title = Language.getString(27740);
            return;
        }

        /* internal  */updateList(): void
        {
            this.clear();
            this._activeList.updateData(ChristmasActivitiesConfig.instance.recallOldPlayerActivitiesList);
            return;
        }

        /* internal  */onListSelectedChangeHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as ChristmasActivitiesInfo;
            if (loc1) 
            {
                this._activeDes.updateData(loc1);
                this._activeReward.updateData(loc1);
            }
            return;
        }

        /* internal  */clear(): void
        {
            this._activeList.dispose();
            this._activeDes.dispose();
            this._activeReward.dispose();
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this._activeList = new ChristmasList(195, 402);
            this._activeList.addEventListener(EventName.ChristmasListSelectedChange, this.onListSelectedChangeHandler);
            addChild(this._activeList);
            this._activeDes = new ChristmasDesPanel(400, 250);
            addChild(this._activeDes);
            this._activeReward = new ChristmasRewardPanel(400, 130);
            addChild(this._activeReward);
            this.updateList();
            return;
        }

        protected /* override */ updateSize(): void
        {
            super.updateSize();
            _windowCenter.y = _windowCenter.y - 20;
            _windowCenter.height = _windowCenter.height + 20;
            this._activeList.x = _windowCenter.x + 5;
            this._activeList.y = _windowCenter.y + 5;
            this._activeDes.x = this._activeList.width + this._activeList.x + 4;
            this._activeDes.y = this._activeList.y + 10;
            this._activeReward.x = this._activeDes.x;
            this._activeReward.y = this._activeDes.y + this._activeDes.height + 12;
            return;
        }

        /* internal */ /* var */_activeList: ChristmasList;

        /* internal */ /* var */_activeDes: ChristmasDesPanel;

        /* internal */ /* var */_activeReward: ChristmasRewardPanel;
    }
